<?php
class inmueble {
  var $id;
  var $cliente;
  function inmueble($id,$cliente){
    $this->id=$id;
    $this->cliente=$cliente;
  }
  function getImage(){
    global $core;
    $db=&$core->getDB();
    $con=&$db->getConexion();
    $q="select * from `imagenes_inmuebles` where `id_expediente`='".mysql_real_escape_string($this->id)."'
	  and `id_cliente`='".mysql_real_escape_string($this->cliente)."' order by `num_imagen` limit 1";

    $r=mysql_query($q);
    if($r){
      $i=mysql_fetch_array($r,MYSQL_ASSOC);
      return (object)$i;
    }
  }

  public function get($param){
    global $core;
    $db=&$core->getDB();
    $con=&$db->getConexion();
    $q="select `".mysql_real_escape_string($param)."` as 'param'
      from `inmuebles`
      where `id_cliente`='".mysql_real_escape_string($this->cliente)."'
      and `id_expediente`='".mysql_real_escape_string($this->id)."'
      limit 1";
    $r=mysql_query($q);
    if($r&&mysql_num_rows($r)){
      $i=mysql_fetch_array($r,MYSQL_ASSOC);
      return $i["param"];
    }
  }
  public function getURL(){
    return "http://www.e-spacios.com/informacion.php?id=".$this->cliente."&exp=".$this->id."";
  }
}
